<div class="tmd-doc">
<p></p>
<h1 class="tmd-header-1">
operator 1
</h1>
<p></p>
<div id="question" class="tmd-base">
<p></p>
<div class="tmd-usual">
What does the following program print?
</div>
<p></p>
<pre class="tmd-code line-numbers">
<code class="language-go">package main

var x, y = true, false

func o(b bool) bool {
	print(b)
	return !b
}

func main() {
	_ = x || o(x)
	_ = y &amp;&amp; o(y)
}
</code></pre>
</div>
<p></p>
<div class="tmd-usual">
Choices:
</div>
<p></p>
<input type="radio" id="choiceA" name="choice" class="choice">
<input type="radio" id="choiceB" name="choice" class="choice">
<input type="radio" id="choiceC" name="choice" class="choice">
<input type="radio" id="choiceD" name="choice" class="choice">

<div id="choices">

<ul style="list-style-type:none;">
<li><label for="choiceA">true</label></li>
<li><label for="choiceB">false</label></li>
<li><label for="choiceC">truefalse</label></li>
<li><label for="choiceD">(It prints nothing)</label></li>
</ul>

</div><p></p>
<div id="answer" class="tmd-base">
<div class="tmd-usual">
Answer: (It prints nothing)
</div>
<p></p>
<div class="tmd-usual">
Run it on <a href="https://go.dev/play/p/N4RCHuFudY-">Go play</a>.
</div>
<p></p>
<div class="tmd-usual">
Key points:
</div>
<ul class="tmd-list">
<li class="tmd-list-item">
<div class="tmd-usual">
When evaluating <code class="tmd-code-span">a || b</code>, the expression <code class="tmd-code-span">a</code> is evaluated firstly and the expression <code class="tmd-code-span">b</code> will be only evaluated if <code class="tmd-code-span">a</code> is evaluated as <code class="tmd-code-span">false</code>.
</div>
</li>
<li class="tmd-list-item">
<div class="tmd-usual">
When evaluating <code class="tmd-code-span">a &amp;&amp; b</code>, the expression <code class="tmd-code-span">a</code> is evaluated firstly and the expression <code class="tmd-code-span">b</code> will be only evaluated if <code class="tmd-code-span">a</code> is evaluated as <code class="tmd-code-span">true</code>.
</div>
</li>
</ul>
<p></p>
</div>
<p></p>
</div>
